


// 100铜币=1银币 100银币=1金币
// 1英镑=20先令=240便士
// 1铜币=20便士

const priceFormat = {

    Units: {
        "copper_coin": {
            "name": "铜币",
            "rate": 1
        },
        "silver_coin": {
            "name": "银币",
            "rate": 100
        },
        "gold_coin": {
            "name": "金币",
            "rate": 10000
        },
        "gold_bar": {
            "name": "金条",
            "rate": 500000
        },
        "pound": {
            "name": "英镑",
            "rate": 4800
        },
        "shilling": {
            "name": "先令",
            "rate": 240
        },
        "pence": {
            "name": "便士",
            "rate": 20
        }
    },

    format(value, unit) {
        if (this.Units[unit]) {
            let base = value * this.Units[unit]["rate"]
            let ret = {}
            for (u in this.Units) {
                ret[u] = base / this.Units[u]["rate"]
            }
            return ret
        }
    }
    

}








module.exports = priceFormat